package com.authsphere.security.web.configuration;

/**
 * @program: AuthSphere
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/21 17:00
 **/
public class SecurityWebConfig {

    private CsrfTokenConfig csrfTokenConfig;

    private RememberMeConfig rememberMeConfig;

    public CsrfTokenConfig getCsrfTokenConfig() {
        return csrfTokenConfig;
    }

    public void setCsrfTokenConfig(CsrfTokenConfig csrfTokenConfig) {
        this.csrfTokenConfig = csrfTokenConfig;
    }

    public RememberMeConfig getRememberMeConfig() {
        return rememberMeConfig;
    }

    public void setRememberMeConfig(RememberMeConfig rememberMeConfig) {
        this.rememberMeConfig = rememberMeConfig;
    }

    public static class CsrfTokenConfig {

        private String headerName = "X-XSRF-TOKEN";

        private String parameterName = "_csrf";

        private String cookieName = "XSRF-TOKEN";

        private String cookiePath = "/";

        private String cookieDomain;

        private Integer cookieMaxAge = -1;

        private Boolean cookieHttpOnly = true;

        private Boolean cookieSecure = true;

        public String getHeaderName() {
            return headerName;
        }

        public void setHeaderName(String headerName) {
            this.headerName = headerName;
        }

        public String getParameterName() {
            return parameterName;
        }

        public void setParameterName(String parameterName) {
            this.parameterName = parameterName;
        }

        public String getCookieName() {
            return cookieName;
        }

        public void setCookieName(String cookieName) {
            this.cookieName = cookieName;
        }

        public String getCookiePath() {
            return cookiePath;
        }

        public void setCookiePath(String cookiePath) {
            this.cookiePath = cookiePath;
        }

        public String getCookieDomain() {
            return cookieDomain;
        }

        public void setCookieDomain(String cookieDomain) {
            this.cookieDomain = cookieDomain;
        }

        public Integer getCookieMaxAge() {
            return cookieMaxAge;
        }

        public void setCookieMaxAge(Integer cookieMaxAge) {
            this.cookieMaxAge = cookieMaxAge;
        }

        public Boolean getCookieHttpOnly() {
            return cookieHttpOnly;
        }

        public void setCookieHttpOnly(Boolean cookieHttpOnly) {
            this.cookieHttpOnly = cookieHttpOnly;
        }

        public Boolean getCookieSecure() {
            return cookieSecure;
        }

        public void setCookieSecure(Boolean cookieSecure) {
            this.cookieSecure = cookieSecure;
        }
    }

    public static class RememberMeConfig {

        private Boolean alwaysRemember = true;

        private String parameterName = "remember-me";

        private String cookieName = "remember-me";

        private String cookiePath = "/";

        private String cookieDomain;

        private Integer cookieMaxAge = -1;

        private Boolean cookieHttpOnly = true;

        private Boolean cookieSecure = true;

        private Boolean autoRenewal = true;

        private Integer renewalInterval = 600;

        public Boolean getAlwaysRemember() {
            return alwaysRemember;
        }

        public void setAlwaysRemember(Boolean alwaysRemember) {
            this.alwaysRemember = alwaysRemember;
        }

        public String getParameterName() {
            return parameterName;
        }

        public void setParameterName(String parameterName) {
            this.parameterName = parameterName;
        }

        public String getCookieName() {
            return cookieName;
        }

        public void setCookieName(String cookieName) {
            this.cookieName = cookieName;
        }

        public String getCookiePath() {
            return cookiePath;
        }

        public void setCookiePath(String cookiePath) {
            this.cookiePath = cookiePath;
        }

        public String getCookieDomain() {
            return cookieDomain;
        }

        public void setCookieDomain(String cookieDomain) {
            this.cookieDomain = cookieDomain;
        }

        public Integer getCookieMaxAge() {
            return cookieMaxAge;
        }

        public void setCookieMaxAge(Integer cookieMaxAge) {
            this.cookieMaxAge = cookieMaxAge;
        }

        public Boolean getCookieHttpOnly() {
            return cookieHttpOnly;
        }

        public void setCookieHttpOnly(Boolean cookieHttpOnly) {
            this.cookieHttpOnly = cookieHttpOnly;
        }

        public Boolean getCookieSecure() {
            return cookieSecure;
        }

        public void setCookieSecure(Boolean cookieSecure) {
            this.cookieSecure = cookieSecure;
        }

        public Boolean getAutoRenewal() {
            return autoRenewal;
        }

        public void setAutoRenewal(Boolean autoRenewal) {
            this.autoRenewal = autoRenewal;
        }

        public Integer getRenewalInterval() {
            return renewalInterval;
        }

        public void setRenewalInterval(Integer renewalInterval) {
            this.renewalInterval = renewalInterval;
        }
    }
}
